﻿Public Class Food

    Dim vFoodType As Integer
    Dim vFoodValue As Integer
    'Dim vDurability As Integer

    Dim FoodPoints As Integer
    Dim Price As Integer

    Public Property FoodType() As Integer
        Get
            Return vFoodType
        End Get
        Set(ByVal value As Integer)
            vFoodType = value
            SetFood(value)
        End Set
    End Property

    Public Property FoodValue() As Integer
        Get
            Return vFoodValue
        End Get
        Set(ByVal value As Integer)
            vFoodValue = value
        End Set
    End Property

    'Private Property Durability() As Integer
    '    Get
    '        Return vDurability
    '    End Get
    '    Set(ByVal value As Integer)
    '        vDurability = value
    '    End Set
    'End Property

    Public Sub Eaten()
        ParentForm.Controls.OfType(Of StatusPoints).ElementAtOrDefault(0).AddPoints(FoodPoints)
        Me.Dispose()
    End Sub

    Public Sub SetFood(ByVal type As Integer)
        Select Case type
            Case 0
                Price = 1
                FoodPoints = 100
                FoodValue = 2
            Case 1
                Price = 2
                FoodPoints = 200
                FoodValue = 4
            Case 2
                Price = 5
                FoodPoints = 500
                FoodValue = 10
        End Select
        SetImages(type)
    End Sub

    Private Sub SetImages(ByVal type As Integer)
        PictureBox1.Image = FoodList.Images((type * 2) + RandVal(2))
    End Sub

    Private Function CheckParentControls()
        Dim result As Integer

        Return result
    End Function

    Public Function RandVal(ByVal Amount As Integer)
        Dim acak As New Random
        Dim vReturn As Integer

        vReturn = acak.Next(Amount)

        Return vReturn
    End Function

    Private Sub Food_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FoodPoints = 50
        Me.BringToFront()

        
    End Sub
End Class
